﻿using System;
using System.Collections.Generic;
using System.ComponentModel.Design;
using System.Text;
using System.Threading.Tasks;
using Test.EventBus2.Core;
using Test.EventBus2.Message.Events.Orders;

namespace Test.EventBus2.Payment.Handlers
{
    public class PaymentHandler : IHandleMessages<PayemntEvent>
    {
        IBus _bus;
        public PaymentHandler(IBus bus)
        {
            _bus = bus;
        }


        public Task Handle(PayemntEvent message)
        {
            Console.WriteLine("收到了支付信息" + message.PayMethod + "||" + message.TotalPrice);
            _bus.PublishMessage(new PayemntedEvent {
            
            OrderId=message.OrderId,
            PayMethod="支付已完成",
            requestID=2,
            TotalPrice=message.TotalPrice
            
            });
            return Task.CompletedTask;

        }
    }

}
